<?php

namespace Application\Models;

use BlogServices\Config;
use BlogServices\ConfigServiceIf;
use Phalcon\Mvc\Model;

class Admin extends Model implements ConfigServiceIf
{
    public function initialize()
    {
        $this->setSource("learn_admin");
    }


    /**
     * @return \BlogServices\Config
     */
    public function GetConfig()
    {
        $config = self::findFirst(1)->toArray();
        $configService = new Config();
        $configService->Email = $config["email"];
        $configService->QQ = $config["qq"];
        $configService->Tel = $config["tel"];
        $configService->Avatar = $config["avatar"];
        $configService->SiteAuthor = $config["site_author"];
        $configService->SiteKeywords = $config["site_keywords"];
        $configService->SiteDescription = $config["site_description"];
        $configService->SiteName = $config["site_name"];
        $configService->SiteIcp = $config["site_icp"];
        $configService->SiteSign = $config["site_sign"];
        return $configService;
    }
}